package com.guys8.cemsbackend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guys8.cemsbackend.entity.Health;
import com.guys8.cemsbackend.mapper.NacidMapper;
import com.guys8.cemsbackend.entity.Nacid;
import com.guys8.cemsbackend.service.NacidService;
import com.guys8.cemsbackend.utils.Others.ListUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (Nacid)表服务实现类
 *
 * @author breeze
 * @since 2022-08-24 16:53:22
 */
@Service("nacidService")
public class NacidServiceImpl extends ServiceImpl<NacidMapper, Nacid> implements NacidService {

    public Nacid getusernowNacid(Integer userId) {
        Map<String,Object> accountMap = new HashMap<>();
        accountMap.put("user_id",userId);
//        accountMap.put("nacid_time",nacidTime);
        List<Nacid> nacids = listByMap(accountMap);
        if(nacids.size()==0) return null;
        return nacids.get(nacids.size()-1);
    }

    public List<Nacid> getallById(Integer userId) {
        Map<String,Object> accountMap = new HashMap<>();
        accountMap.put("user_id",userId);
        return ListUtil.getOppoList(listByMap(accountMap));
    }
}

